package competition_project

import org.apache.spark.sql.SparkSession

import java.util.Properties

object recommend_to_file {
  def main(args: Array[String]): Unit = {
    val spark=SparkSession.builder()
      .master("local[*]")
      .appName("把推荐的结果弄成文件")
      .getOrCreate()

    val connect=new Properties()
    connect.setProperty("user","root")
    connect.setProperty("password","123456")
    connect.setProperty("driver","com.mysql.jdbc.Driver")

    val data=spark.read
      .jdbc("jdbc:mysql://192.168.40.110:3306/competition?useSSL=false","result_recommend",connect)
//    println(System.getProperty("user.dir"))
    data.write
      .option("header","true")
      .csv("hdfs://192.168.40.110:9000/datas/result_recommend.csv")



    spark.close()
  }
}
